Skip to content

s390x: z17 target feature detection #1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

folkertdev
Copy link
Contributor

tracking issue: rust-lang/rust#130869

I didn't add feature detection yet in #1826.

The implementation follows the information in rust-lang/rust#135413 (comment), in particular that HWCAP is used to check for the vector feature because it needs kernel support, and stfle is used for the other features because they only need hardware support.

cc @uweigand @taiki-e

@rustbot
Copy link
Collaborator

rustbot commented Jun 12, 2025

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@folkertdev folkertdev force-pushed the s390x-z17-target-feature-detection branch from d968db9 to 7bf8a59 Compare June 12, 2025 17:20
/// These values are part of the platform-specific [asm/elf.h][kernel], and are a selection of the
/// fields found in the [Facility Indications].
///
/// [Facility Indications]: https://www.ibm.com/support/pages/sites/default/files/2021-05/SA22-7871-10.pdf#page=63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get the information about the facility bits that will be added in z17? (It is not included in the documentation at this link.)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that the z17 facility bit values are correct. The new version of the Principles of Operation including z17 features will be released shortly after the general availability of the new machine (which is next week).

@folkertdev folkertdev force-pushed the s390x-z17-target-feature-detection branch from 7bf8a59 to 3809ead Compare June 12, 2025 17:31
enable_if_set(133, Feature::guarded_storage);
enable_if_set(150, Feature::enhanced_sort);
enable_if_set(151, Feature::deflate_conversion);
// added in z17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this comment? If so, should we add this information also for the vector-related facilities, and also specific machine information for pre-z17 machines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, this list doesn't really have structure to it, but it should be OK given the official docs.

enable_if_set(151, Feature::deflate_conversion);
// added in z17
enable_if_set(84, Feature::miscellaneous_extensions_4);
enable_if_set(86, Feature::message_security_assist_extension12);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should really include all currently defined features here. What I see missing is the older variants of miscellaneous_extensions and messact_security_assist_extension. These all have defined facility bits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can only add features here when they are also recognized by the compiler. I'll add them there, but that does not need to block this PR I think

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I forgot that we did already add these to the compiler. Now they're in this PR too.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks good to me now.

@folkertdev folkertdev force-pushed the s390x-z17-target-feature-detection branch 3 times, most recently from 9ab93dc to 1ddb86f Compare June 18, 2025 15:35
@Amanieu Amanieu added this pull request to the merge queue Jun 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 19, 2025
@folkertdev
Copy link
Contributor Author

the build broke because a feature got stabilized:

    Updating crates.io index
   Compiling core_arch v0.1.5 (/Users/runner/work/stdarch/stdarch/crates/core_arch)
error: the feature `generic_arg_infer` has been stable since 1.89.0-nightly and no longer requires an attribute to enable
  --> crates/core_arch/src/lib.rs:34:5
   |
34 |     generic_arg_infer,
   |     ^^^^^^^^^^^^^^^^^
   |
   = note: `-D stable-features` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(stable_features)]`

error: could not compile `core_arch` (lib) due to 1 previous error

I'll add a commit to remove that line

@folkertdev folkertdev force-pushed the s390x-z17-target-feature-detection branch from 1ddb86f to dac9666 Compare June 19, 2025 14:49
@Amanieu Amanieu enabled auto-merge June 19, 2025 14:50
@Amanieu Amanieu added this pull request to the merge queue Jun 19, 2025
Merged via the queue into rust-lang:master with commit 5a7342f Jun 19, 2025
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants